package com.es.hr.emp;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.es.main.LoginUserBeen;
import com.es.util.common.CommonBiz;
import com.opensymphony.webwork.interceptor.ServletRequestAware;
import com.opensymphony.webwork.interceptor.ServletResponseAware;
import com.opensymphony.xwork.ActionSupport;

@SuppressWarnings("serial")
public class AjaxCheckLoginIdAction  extends ActionSupport implements ServletRequestAware, ServletResponseAware{
	
	  HttpServletRequest request;
	  HttpServletResponse response;

	  public String execute() throws Exception{
		  CommonBiz biz = new CommonBiz((LoginUserBeen)request.getSession(false).getAttribute("loginuser"));
		  String queryLoginId = request.getParameter("queryLoginId").trim();
		  String msg = "success";
		  if(biz.CheckLoginId(queryLoginId))
			  msg="error";
	      response.setContentType("text/text;charset=utf-8");
	      response.getWriter().write(msg);
	      return "";
	  }

	  public void setServletRequest(HttpServletRequest request) {
	    this.request = request;
	  }

	  public void setServletResponse(HttpServletResponse response) {
	    this.response = response;
	  }
	}
